using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class BeginCashMap : EntityTypeConfiguration<BeginCash>
    {
        public BeginCashMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("BeginCash");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.REGNUM).HasColumnName("REGNUM");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.AMOUNT).HasColumnName("AMOUNT");
            this.Property(t => t.DAILYPAIDOUT).HasColumnName("DAILYPAIDOUT");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");

            // Relationships
            this.HasOptional(t => t.currency1)
                .WithMany(t => t.BeginCashes)
                .HasForeignKey(d => d.CURRENCY);
            this.HasOptional(t => t.Register)
                .WithMany(t => t.BeginCashes)
                .HasForeignKey(d => d.REGNUM);

        }
    }
}
